#pragma once
// MESSAGE ATTITUDE_BODY_DATA PACKING

#define MAVLINK_MSG_ID_ATTITUDE_BODY_DATA 20

MAVPACKED(
typedef struct __mavlink_attitude_body_data_t {
 uint32_t state; /*<  calculating state.*/
 float q0; /*<  quaternion q0.*/
 float q1; /*<  quaternion q1.*/
 float q2; /*<  quaternion q2.*/
 float q3; /*<  quaternion q3.*/
 float roll; /*<  roll angle.*/
 float pitch; /*<  pitch angle.*/
 float yaw; /*<  yaw angle.*/
 float bw_x; /*<  x axis angle speed in B coordinate.*/
 float bw_y; /*<  y axis angle speed in B coordinate.*/
 float bw_z; /*<  z axis angle speed in B coordinate.*/
 float nw_x; /*<  x axis angle speed in N coordinate.*/
 float nw_y; /*<  y axis angle speed in N coordinate.*/
 float nw_z; /*<  z axis angle speed in N coordinate.*/
 float bw_bia_x; /*<  Zero deviation of gyro x axis.*/
 float bw_bia_y; /*<  Zero deviation of gyro y axis.*/
 float bw_bia_z; /*<  Zero deviation of gyro z axis.*/
 float ba_x; /*<  x axis acceleration in B coordinate.*/
 float ba_y; /*<  y axis acceleration in B coordinate.*/
 float ba_z; /*<  z axis acceleration in B coordinate.*/
 float ba_bia_x; /*<  Zero deviation of gyro x axis acceleration.*/
 float ba_bia_y; /*<  Zero deviation of gyro y axis acceleration.*/
 float ba_bia_z; /*<  Zero deviation of gyro z axis acceleration.*/
 float bm_x; /*<  x axis magnet in B coordinate.*/
 float bm_y; /*<  y axis magnet in B coordinate.*/
 float bm_z; /*<  z axis magnet in B coordinate.*/
 float bm_bia_x; /*<  Zero deviation of magnet x axis.*/
 float bm_bia_y; /*<  Zero deviation of magnet y axis.*/
 float bm_bia_z; /*<  Zero deviation of magnet z axis.*/
}) mavlink_attitude_body_data_t;

#define MAVLINK_MSG_ID_ATTITUDE_BODY_DATA_LEN 116
#define MAVLINK_MSG_ID_ATTITUDE_BODY_DATA_MIN_LEN 116
#define MAVLINK_MSG_ID_20_LEN 116
#define MAVLINK_MSG_ID_20_MIN_LEN 116

#define MAVLINK_MSG_ID_ATTITUDE_BODY_DATA_CRC 219
#define MAVLINK_MSG_ID_20_CRC 219



#if MAVLINK_COMMAND_24BIT
#define MAVLINK_MESSAGE_INFO_ATTITUDE_BODY_DATA { \
    20, \
    "ATTITUDE_BODY_DATA", \
    29, \
    {  { "state", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_attitude_body_data_t, state) }, \
         { "q0", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_attitude_body_data_t, q0) }, \
         { "q1", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_attitude_body_data_t, q1) }, \
         { "q2", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_attitude_body_data_t, q2) }, \
         { "q3", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_attitude_body_data_t, q3) }, \
         { "roll", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_attitude_body_data_t, roll) }, \
         { "pitch", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_attitude_body_data_t, pitch) }, \
         { "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_attitude_body_data_t, yaw) }, \
         { "bw_x", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_attitude_body_data_t, bw_x) }, \
         { "bw_y", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_attitude_body_data_t, bw_y) }, \
         { "bw_z", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_attitude_body_data_t, bw_z) }, \
         { "nw_x", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_attitude_body_data_t, nw_x) }, \
         { "nw_y", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_attitude_body_data_t, nw_y) }, \
         { "nw_z", NULL, MAVLINK_TYPE_FLOAT, 0, 52, offsetof(mavlink_attitude_body_data_t, nw_z) }, \
         { "bw_bia_x", NULL, MAVLINK_TYPE_FLOAT, 0, 56, offsetof(mavlink_attitude_body_data_t, bw_bia_x) }, \
         { "bw_bia_y", NULL, MAVLINK_TYPE_FLOAT, 0, 60, offsetof(mavlink_attitude_body_data_t, bw_bia_y) }, \
         { "bw_bia_z", NULL, MAVLINK_TYPE_FLOAT, 0, 64, offsetof(mavlink_attitude_body_data_t, bw_bia_z) }, \
         { "ba_x", NULL, MAVLINK_TYPE_FLOAT, 0, 68, offsetof(mavlink_attitude_body_data_t, ba_x) }, \
         { "ba_y", NULL, MAVLINK_TYPE_FLOAT, 0, 72, offsetof(mavlink_attitude_body_data_t, ba_y) }, \
         { "ba_z", NULL, MAVLINK_TYPE_FLOAT, 0, 76, offsetof(mavlink_attitude_body_data_t, ba_z) }, \
         { "ba_bia_x", NULL, MAVLINK_TYPE_FLOAT, 0, 80, offsetof(mavlink_attitude_body_data_t, ba_bia_x) }, \
         { "ba_bia_y", NULL, MAVLINK_TYPE_FLOAT, 0, 84, offsetof(mavlink_attitude_body_data_t, ba_bia_y) }, \
         { "ba_bia_z", NULL, MAVLINK_TYPE_FLOAT, 0, 88, offsetof(mavlink_attitude_body_data_t, ba_bia_z) }, \
         { "bm_x", NULL, MAVLINK_TYPE_FLOAT, 0, 92, offsetof(mavlink_attitude_body_data_t, bm_x) }, \
         { "bm_y", NULL, MAVLINK_TYPE_FLOAT, 0, 96, offsetof(mavlink_attitude_body_data_t, bm_y) }, \
         { "bm_z", NULL, MAVLINK_TYPE_FLOAT, 0, 100, offsetof(mavlink_attitude_body_data_t, bm_z) }, \
         { "bm_bia_x", NULL, MAVLINK_TYPE_FLOAT, 0, 104, offsetof(mavlink_attitude_body_data_t, bm_bia_x) }, \
         { "bm_bia_y", NULL, MAVLINK_TYPE_FLOAT, 0, 108, offsetof(mavlink_attitude_body_data_t, bm_bia_y) }, \
         { "bm_bia_z", NULL, MAVLINK_TYPE_FLOAT, 0, 112, offsetof(mavlink_attitude_body_data_t, bm_bia_z) }, \
         } \
}
#else
#define MAVLINK_MESSAGE_INFO_ATTITUDE_BODY_DATA { \
    "ATTITUDE_BODY_DATA", \
    29, \
    {  { "state", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_attitude_body_data_t, state) }, \
         { "q0", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_attitude_body_data_t, q0) }, \
         { "q1", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_attitude_body_data_t, q1) }, \
         { "q2", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_attitude_body_data_t, q2) }, \
         { "q3", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_attitude_body_data_t, q3) }, \
         { "roll", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_attitude_body_data_t, roll) }, \
         { "pitch", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_attitude_body_data_t, pitch) }, \
         { "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_attitude_body_data_t, yaw) }, \
         { "bw_x", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_attitude_body_data_t, bw_x) }, \
         { "bw_y", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_attitude_body_data_t, bw_y) }, \
         { "bw_z", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_attitude_body_data_t, bw_z) }, \
         { "nw_x", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_attitude_body_data_t, nw_x) }, \
         { "nw_y", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_attitude_body_data_t, nw_y) }, \
         { "nw_z", NULL, MAVLINK_TYPE_FLOAT, 0, 52, offsetof(mavlink_attitude_body_data_t, nw_z) }, \
         { "bw_bia_x", NULL, MAVLINK_TYPE_FLOAT, 0, 56, offsetof(mavlink_attitude_body_data_t, bw_bia_x) }, \
         { "bw_bia_y", NULL, MAVLINK_TYPE_FLOAT, 0, 60, offsetof(mavlink_attitude_body_data_t, bw_bia_y) }, \
         { "bw_bia_z", NULL, MAVLINK_TYPE_FLOAT, 0, 64, offsetof(mavlink_attitude_body_data_t, bw_bia_z) }, \
         { "ba_x", NULL, MAVLINK_TYPE_FLOAT, 0, 68, offsetof(mavlink_attitude_body_data_t, ba_x) }, \
         { "ba_y", NULL, MAVLINK_TYPE_FLOAT, 0, 72, offsetof(mavlink_attitude_body_data_t, ba_y) }, \
         { "ba_z", NULL, MAVLINK_TYPE_FLOAT, 0, 76, offsetof(mavlink_attitude_body_data_t, ba_z) }, \
         { "ba_bia_x", NULL, MAVLINK_TYPE_FLOAT, 0, 80, offsetof(mavlink_attitude_body_data_t, ba_bia_x) }, \
         { "ba_bia_y", NULL, MAVLINK_TYPE_FLOAT, 0, 84, offsetof(mavlink_attitude_body_data_t, ba_bia_y) }, \
         { "ba_bia_z", NULL, MAVLINK_TYPE_FLOAT, 0, 88, offsetof(mavlink_attitude_body_data_t, ba_bia_z) }, \
         { "bm_x", NULL, MAVLINK_TYPE_FLOAT, 0, 92, offsetof(mavlink_attitude_body_data_t, bm_x) }, \
         { "bm_y", NULL, MAVLINK_TYPE_FLOAT, 0, 96, offsetof(mavlink_attitude_body_data_t, bm_y) }, \
         { "bm_z", NULL, MAVLINK_TYPE_FLOAT, 0, 100, offsetof(mavlink_attitude_body_data_t, bm_z) }, \
         { "bm_bia_x", NULL, MAVLINK_TYPE_FLOAT, 0, 104, offsetof(mavlink_attitude_body_data_t, bm_bia_x) }, \
         { "bm_bia_y", NULL, MAVLINK_TYPE_FLOAT, 0, 108, offsetof(mavlink_attitude_body_data_t, bm_bia_y) }, \
         { "bm_bia_z", NULL, MAVLINK_TYPE_FLOAT, 0, 112, offsetof(mavlink_attitude_body_data_t, bm_bia_z) }, \
         } \
}
#endif

/**
 * @brief Pack a attitude_body_data message
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 *
 * @param state  calculating state.
 * @param q0  quaternion q0.
 * @param q1  quaternion q1.
 * @param q2  quaternion q2.
 * @param q3  quaternion q3.
 * @param roll  roll angle.
 * @param pitch  pitch angle.
 * @param yaw  yaw angle.
 * @param bw_x  x axis angle speed in B coordinate.
 * @param bw_y  y axis angle speed in B coordinate.
 * @param bw_z  z axis angle speed in B coordinate.
 * @param nw_x  x axis angle speed in N coordinate.
 * @param nw_y  y axis angle speed in N coordinate.
 * @param nw_z  z axis angle speed in N coordinate.
 * @param bw_bia_x  Zero deviation of gyro x axis.
 * @param bw_bia_y  Zero deviation of gyro y axis.
 * @param bw_bia_z  Zero deviation of gyro z axis.
 * @param ba_x  x axis acceleration in B coordinate.
 * @param ba_y  y axis acceleration in B coordinate.
 * @param ba_z  z axis acceleration in B coordinate.
 * @param ba_bia_x  Zero deviation of gyro x axis acceleration.
 * @param ba_bia_y  Zero deviation of gyro y axis acceleration.
 * @param ba_bia_z  Zero deviation of gyro z axis acceleration.
 * @param bm_x  x axis magnet in B coordinate.
 * @param bm_y  y axis magnet in B coordinate.
 * @param bm_z  z axis magnet in B coordinate.
 * @param bm_bia_x  Zero deviation of magnet x axis.
 * @param bm_bia_y  Zero deviation of magnet y axis.
 * @param bm_bia_z  Zero deviation of magnet z axis.
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_attitude_body_data_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
                               uint32_t state, float q0, float q1, float q2, float q3, float roll, float pitch, float yaw, float bw_x, float bw_y, float bw_z, float nw_x, float nw_y, float nw_z, float bw_bia_x, float bw_bia_y, float bw_bia_z, float ba_x, float ba_y, float ba_z, float ba_bia_x, float ba_bia_y, float ba_bia_z, float bm_x, float bm_y, float bm_z, float bm_bia_x, float bm_bia_y, float bm_bia_z)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_ATTITUDE_BODY_DATA_LEN];
    _mav_put_uint32_t(buf, 0, state);
    _mav_put_float(buf, 4, q0);
    _mav_put_float(buf, 8, q1);
    _mav_put_float(buf, 12, q2);
    _mav_put_float(buf, 16, q3);
    _mav_put_float(buf, 20, roll);
    _mav_put_float(buf, 24, pitch);
    _mav_put_float(buf, 28, yaw);
    _mav_put_float(buf, 32, bw_x);
    _mav_put_float(buf, 36, bw_y);
    _mav_put_float(buf, 40, bw_z);
    _mav_put_float(buf, 44, nw_x);
    _mav_put_float(buf, 48, nw_y);
    _mav_put_float(buf, 52, nw_z);
    _mav_put_float(buf, 56, bw_bia_x);
    _mav_put_float(buf, 60, bw_bia_y);
    _mav_put_float(buf, 64, bw_bia_z);
    _mav_put_float(buf, 68, ba_x);
    _mav_put_float(buf, 72, ba_y);
    _mav_put_float(buf, 76, ba_z);
    _mav_put_float(buf, 80, ba_bia_x);
    _mav_put_float(buf, 84, ba_bia_y);
    _mav_put_float(buf, 88, ba_bia_z);
    _mav_put_float(buf, 92, bm_x);
    _mav_put_float(buf, 96, bm_y);
    _mav_put_float(buf, 100, bm_z);
    _mav_put_float(buf, 104, bm_bia_x);
    _mav_put_float(buf, 108, bm_bia_y);
    _mav_put_float(buf, 112, bm_bia_z);

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ATTITUDE_BODY_DATA_LEN);
#else
    mavlink_attitude_body_data_t packet;
    packet.state = state;
    packet.q0 = q0;
    packet.q1 = q1;
    packet.q2 = q2;
    packet.q3 = q3;
    packet.roll = roll;
    packet.pitch = pitch;
    packet.yaw = yaw;
    packet.bw_x = bw_x;
    packet.bw_y = bw_y;
    packet.bw_z = bw_z;
    packet.nw_x = nw_x;
    packet.nw_y = nw_y;
    packet.nw_z = nw_z;
    packet.bw_bia_x = bw_bia_x;
    packet.bw_bia_y = bw_bia_y;
    packet.bw_bia_z = bw_bia_z;
    packet.ba_x = ba_x;
    packet.ba_y = ba_y;
    packet.ba_z = ba_z;
    packet.ba_bia_x = ba_bia_x;
    packet.ba_bia_y = ba_bia_y;
    packet.ba_bia_z = ba_bia_z;
    packet.bm_x = bm_x;
    packet.bm_y = bm_y;
    packet.bm_z = bm_z;
    packet.bm_bia_x = bm_bia_x;
    packet.bm_bia_y = bm_bia_y;
    packet.bm_bia_z = bm_bia_z;

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ATTITUDE_BODY_DATA_LEN);
#endif

    msg->msgid = MAVLINK_MSG_ID_ATTITUDE_BODY_DATA;
    return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ATTITUDE_BODY_DATA_MIN_LEN, MAVLINK_MSG_ID_ATTITUDE_BODY_DATA_LEN, MAVLINK_MSG_ID_ATTITUDE_BODY_DATA_CRC);
}

/**
 * @brief Pack a attitude_body_data message on a channel
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message will be sent over
 * @param msg The MAVLink message to compress the data into
 * @param state  calculating state.
 * @param q0  quaternion q0.
 * @param q1  quaternion q1.
 * @param q2  quaternion q2.
 * @param q3  quaternion q3.
 * @param roll  roll angle.
 * @param pitch  pitch angle.
 * @param yaw  yaw angle.
 * @param bw_x  x axis angle speed in B coordinate.
 * @param bw_y  y axis angle speed in B coordinate.
 * @param bw_z  z axis angle speed in B coordinate.
 * @param nw_x  x axis angle speed in N coordinate.
 * @param nw_y  y axis angle speed in N coordinate.
 * @param nw_z  z axis angle speed in N coordinate.
 * @param bw_bia_x  Zero deviation of gyro x axis.
 * @param bw_bia_y  Zero deviation of gyro y axis.
 * @param bw_bia_z  Zero deviation of gyro z axis.
 * @param ba_x  x axis acceleration in B coordinate.
 * @param ba_y  y axis acceleration in B coordinate.
 * @param ba_z  z axis acceleration in B coordinate.
 * @param ba_bia_x  Zero deviation of gyro x axis acceleration.
 * @param ba_bia_y  Zero deviation of gyro y axis acceleration.
 * @param ba_bia_z  Zero deviation of gyro z axis acceleration.
 * @param bm_x  x axis magnet in B coordinate.
 * @param bm_y  y axis magnet in B coordinate.
 * @param bm_z  z axis magnet in B coordinate.
 * @param bm_bia_x  Zero deviation of magnet x axis.
 * @param bm_bia_y  Zero deviation of magnet y axis.
 * @param bm_bia_z  Zero deviation of magnet z axis.
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_attitude_body_data_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
                               mavlink_message_t* msg,
                                   uint32_t state,float q0,float q1,float q2,float q3,float roll,float pitch,float yaw,float bw_x,float bw_y,float bw_z,float nw_x,float nw_y,float nw_z,float bw_bia_x,float bw_bia_y,float bw_bia_z,float ba_x,float ba_y,float ba_z,float ba_bia_x,float ba_bia_y,float ba_bia_z,float bm_x,float bm_y,float bm_z,float bm_bia_x,float bm_bia_y,float bm_bia_z)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_ATTITUDE_BODY_DATA_LEN];
    _mav_put_uint32_t(buf, 0, state);
    _mav_put_float(buf, 4, q0);
    _mav_put_float(buf, 8, q1);
    _mav_put_float(buf, 12, q2);
    _mav_put_float(buf, 16, q3);
    _mav_put_float(buf, 20, roll);
    _mav_put_float(buf, 24, pitch);
    _mav_put_float(buf, 28, yaw);
    _mav_put_float(buf, 32, bw_x);
    _mav_put_float(buf, 36, bw_y);
    _mav_put_float(buf, 40, bw_z);
    _mav_put_float(buf, 44, nw_x);
    _mav_put_float(buf, 48, nw_y);
    _mav_put_float(buf, 52, nw_z);
    _mav_put_float(buf, 56, bw_bia_x);
    _mav_put_float(buf, 60, bw_bia_y);
    _mav_put_float(buf, 64, bw_bia_z);
    _mav_put_float(buf, 68, ba_x);
    _mav_put_float(buf, 72, ba_y);
    _mav_put_float(buf, 76, ba_z);
    _mav_put_float(buf, 80, ba_bia_x);
    _mav_put_float(buf, 84, ba_bia_y);
    _mav_put_float(buf, 88, ba_bia_z);
    _mav_put_float(buf, 92, bm_x);
    _mav_put_float(buf, 96, bm_y);
    _mav_put_float(buf, 100, bm_z);
    _mav_put_float(buf, 104, bm_bia_x);
    _mav_put_float(buf, 108, bm_bia_y);
    _mav_put_float(buf, 112, bm_bia_z);

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ATTITUDE_BODY_DATA_LEN);
#else
    mavlink_attitude_body_data_t packet;
    packet.state = state;
    packet.q0 = q0;
    packet.q1 = q1;
    packet.q2 = q2;
    packet.q3 = q3;
    packet.roll = roll;
    packet.pitch = pitch;
    packet.yaw = yaw;
    packet.bw_x = bw_x;
    packet.bw_y = bw_y;
    packet.bw_z = bw_z;
    packet.nw_x = nw_x;
    packet.nw_y = nw_y;
    packet.nw_z = nw_z;
    packet.bw_bia_x = bw_bia_x;
    packet.bw_bia_y = bw_bia_y;
    packet.bw_bia_z = bw_bia_z;
    packet.ba_x = ba_x;
    packet.ba_y = ba_y;
    packet.ba_z = ba_z;
    packet.ba_bia_x = ba_bia_x;
    packet.ba_bia_y = ba_bia_y;
    packet.ba_bia_z = ba_bia_z;
    packet.bm_x = bm_x;
    packet.bm_y = bm_y;
    packet.bm_z = bm_z;
    packet.bm_bia_x = bm_bia_x;
    packet.bm_bia_y = bm_bia_y;
    packet.bm_bia_z = bm_bia_z;

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ATTITUDE_BODY_DATA_LEN);
#endif

    msg->msgid = MAVLINK_MSG_ID_ATTITUDE_BODY_DATA;
    return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ATTITUDE_BODY_DATA_MIN_LEN, MAVLINK_MSG_ID_ATTITUDE_BODY_DATA_LEN, MAVLINK_MSG_ID_ATTITUDE_BODY_DATA_CRC);
}

/**
 * @brief Encode a attitude_body_data struct
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 * @param attitude_body_data C-struct to read the message contents from
 */
static inline uint16_t mavlink_msg_attitude_body_data_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_attitude_body_data_t* attitude_body_data)
{
    return mavlink_msg_attitude_body_data_pack(system_id, component_id, msg, attitude_body_data->state, attitude_body_data->q0, attitude_body_data->q1, attitude_body_data->q2, attitude_body_data->q3, attitude_body_data->roll, attitude_body_data->pitch, attitude_body_data->yaw, attitude_body_data->bw_x, attitude_body_data->bw_y, attitude_body_data->bw_z, attitude_body_data->nw_x, attitude_body_data->nw_y, attitude_body_data->nw_z, attitude_body_data->bw_bia_x, attitude_body_data->bw_bia_y, attitude_body_data->bw_bia_z, attitude_body_data->ba_x, attitude_body_data->ba_y, attitude_body_data->ba_z, attitude_body_data->ba_bia_x, attitude_body_data->ba_bia_y, attitude_body_data->ba_bia_z, attitude_body_data->bm_x, attitude_body_data->bm_y, attitude_body_data->bm_z, attitude_body_data->bm_bia_x, attitude_body_data->bm_bia_y, attitude_body_data->bm_bia_z);
}

/**
 * @brief Encode a attitude_body_data struct on a channel
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message will be sent over
 * @param msg The MAVLink message to compress the data into
 * @param attitude_body_data C-struct to read the message contents from
 */
static inline uint16_t mavlink_msg_attitude_body_data_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_attitude_body_data_t* attitude_body_data)
{
    return mavlink_msg_attitude_body_data_pack_chan(system_id, component_id, chan, msg, attitude_body_data->state, attitude_body_data->q0, attitude_body_data->q1, attitude_body_data->q2, attitude_body_data->q3, attitude_body_data->roll, attitude_body_data->pitch, attitude_body_data->yaw, attitude_body_data->bw_x, attitude_body_data->bw_y, attitude_body_data->bw_z, attitude_body_data->nw_x, attitude_body_data->nw_y, attitude_body_data->nw_z, attitude_body_data->bw_bia_x, attitude_body_data->bw_bia_y, attitude_body_data->bw_bia_z, attitude_body_data->ba_x, attitude_body_data->ba_y, attitude_body_data->ba_z, attitude_body_data->ba_bia_x, attitude_body_data->ba_bia_y, attitude_body_data->ba_bia_z, attitude_body_data->bm_x, attitude_body_data->bm_y, attitude_body_data->bm_z, attitude_body_data->bm_bia_x, attitude_body_data->bm_bia_y, attitude_body_data->bm_bia_z);
}

/**
 * @brief Send a attitude_body_data message
 * @param chan MAVLink channel to send the message
 *
 * @param state  calculating state.
 * @param q0  quaternion q0.
 * @param q1  quaternion q1.
 * @param q2  quaternion q2.
 * @param q3  quaternion q3.
 * @param roll  roll angle.
 * @param pitch  pitch angle.
 * @param yaw  yaw angle.
 * @param bw_x  x axis angle speed in B coordinate.
 * @param bw_y  y axis angle speed in B coordinate.
 * @param bw_z  z axis angle speed in B coordinate.
 * @param nw_x  x axis angle speed in N coordinate.
 * @param nw_y  y axis angle speed in N coordinate.
 * @param nw_z  z axis angle speed in N coordinate.
 * @param bw_bia_x  Zero deviation of gyro x axis.
 * @param bw_bia_y  Zero deviation of gyro y axis.
 * @param bw_bia_z  Zero deviation of gyro z axis.
 * @param ba_x  x axis acceleration in B coordinate.
 * @param ba_y  y axis acceleration in B coordinate.
 * @param ba_z  z axis acceleration in B coordinate.
 * @param ba_bia_x  Zero deviation of gyro x axis acceleration.
 * @param ba_bia_y  Zero deviation of gyro y axis acceleration.
 * @param ba_bia_z  Zero deviation of gyro z axis acceleration.
 * @param bm_x  x axis magnet in B coordinate.
 * @param bm_y  y axis magnet in B coordinate.
 * @param bm_z  z axis magnet in B coordinate.
 * @param bm_bia_x  Zero deviation of magnet x axis.
 * @param bm_bia_y  Zero deviation of magnet y axis.
 * @param bm_bia_z  Zero deviation of magnet z axis.
 */
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS

static inline void mavlink_msg_attitude_body_data_send(mavlink_channel_t chan, uint32_t state, float q0, float q1, float q2, float q3, float roll, float pitch, float yaw, float bw_x, float bw_y, float bw_z, float nw_x, float nw_y, float nw_z, float bw_bia_x, float bw_bia_y, float bw_bia_z, float ba_x, float ba_y, float ba_z, float ba_bia_x, float ba_bia_y, float ba_bia_z, float bm_x, float bm_y, float bm_z, float bm_bia_x, float bm_bia_y, float bm_bia_z)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_ATTITUDE_BODY_DATA_LEN];
    _mav_put_uint32_t(buf, 0, state);
    _mav_put_float(buf, 4, q0);
    _mav_put_float(buf, 8, q1);
    _mav_put_float(buf, 12, q2);
    _mav_put_float(buf, 16, q3);
    _mav_put_float(buf, 20, roll);
    _mav_put_float(buf, 24, pitch);
    _mav_put_float(buf, 28, yaw);
    _mav_put_float(buf, 32, bw_x);
    _mav_put_float(buf, 36, bw_y);
    _mav_put_float(buf, 40, bw_z);
    _mav_put_float(buf, 44, nw_x);
    _mav_put_float(buf, 48, nw_y);
    _mav_put_float(buf, 52, nw_z);
    _mav_put_float(buf, 56, bw_bia_x);
    _mav_put_float(buf, 60, bw_bia_y);
    _mav_put_float(buf, 64, bw_bia_z);
    _mav_put_float(buf, 68, ba_x);
    _mav_put_float(buf, 72, ba_y);
    _mav_put_float(buf, 76, ba_z);
    _mav_put_float(buf, 80, ba_bia_x);
    _mav_put_float(buf, 84, ba_bia_y);
    _mav_put_float(buf, 88, ba_bia_z);
    _mav_put_float(buf, 92, bm_x);
    _mav_put_float(buf, 96, bm_y);
    _mav_put_float(buf, 100, bm_z);
    _mav_put_float(buf, 104, bm_bia_x);
    _mav_put_float(buf, 108, bm_bia_y);
    _mav_put_float(buf, 112, bm_bia_z);

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_BODY_DATA, buf, MAVLINK_MSG_ID_ATTITUDE_BODY_DATA_MIN_LEN, MAVLINK_MSG_ID_ATTITUDE_BODY_DATA_LEN, MAVLINK_MSG_ID_ATTITUDE_BODY_DATA_CRC);
#else
    mavlink_attitude_body_data_t packet;
    packet.state = state;
    packet.q0 = q0;
    packet.q1 = q1;
    packet.q2 = q2;
    packet.q3 = q3;
    packet.roll = roll;
    packet.pitch = pitch;
    packet.yaw = yaw;
    packet.bw_x = bw_x;
    packet.bw_y = bw_y;
    packet.bw_z = bw_z;
    packet.nw_x = nw_x;
    packet.nw_y = nw_y;
    packet.nw_z = nw_z;
    packet.bw_bia_x = bw_bia_x;
    packet.bw_bia_y = bw_bia_y;
    packet.bw_bia_z = bw_bia_z;
    packet.ba_x = ba_x;
    packet.ba_y = ba_y;
    packet.ba_z = ba_z;
    packet.ba_bia_x = ba_bia_x;
    packet.ba_bia_y = ba_bia_y;
    packet.ba_bia_z = ba_bia_z;
    packet.bm_x = bm_x;
    packet.bm_y = bm_y;
    packet.bm_z = bm_z;
    packet.bm_bia_x = bm_bia_x;
    packet.bm_bia_y = bm_bia_y;
    packet.bm_bia_z = bm_bia_z;

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_BODY_DATA, (const char *)&packet, MAVLINK_MSG_ID_ATTITUDE_BODY_DATA_MIN_LEN, MAVLINK_MSG_ID_ATTITUDE_BODY_DATA_LEN, MAVLINK_MSG_ID_ATTITUDE_BODY_DATA_CRC);
#endif
}

/**
 * @brief Send a attitude_body_data message
 * @param chan MAVLink channel to send the message
 * @param struct The MAVLink struct to serialize
 */
static inline void mavlink_msg_attitude_body_data_send_struct(mavlink_channel_t chan, const mavlink_attitude_body_data_t* attitude_body_data)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    mavlink_msg_attitude_body_data_send(chan, attitude_body_data->state, attitude_body_data->q0, attitude_body_data->q1, attitude_body_data->q2, attitude_body_data->q3, attitude_body_data->roll, attitude_body_data->pitch, attitude_body_data->yaw, attitude_body_data->bw_x, attitude_body_data->bw_y, attitude_body_data->bw_z, attitude_body_data->nw_x, attitude_body_data->nw_y, attitude_body_data->nw_z, attitude_body_data->bw_bia_x, attitude_body_data->bw_bia_y, attitude_body_data->bw_bia_z, attitude_body_data->ba_x, attitude_body_data->ba_y, attitude_body_data->ba_z, attitude_body_data->ba_bia_x, attitude_body_data->ba_bia_y, attitude_body_data->ba_bia_z, attitude_body_data->bm_x, attitude_body_data->bm_y, attitude_body_data->bm_z, attitude_body_data->bm_bia_x, attitude_body_data->bm_bia_y, attitude_body_data->bm_bia_z);
#else
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_BODY_DATA, (const char *)attitude_body_data, MAVLINK_MSG_ID_ATTITUDE_BODY_DATA_MIN_LEN, MAVLINK_MSG_ID_ATTITUDE_BODY_DATA_LEN, MAVLINK_MSG_ID_ATTITUDE_BODY_DATA_CRC);
#endif
}

#if MAVLINK_MSG_ID_ATTITUDE_BODY_DATA_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
  This varient of _send() can be used to save stack space by re-using
  memory from the receive buffer.  The caller provides a
  mavlink_message_t which is the size of a full mavlink message. This
  is usually the receive buffer for the channel, and allows a reply to an
  incoming message with minimum stack space usage.
 */
static inline void mavlink_msg_attitude_body_data_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan,  uint32_t state, float q0, float q1, float q2, float q3, float roll, float pitch, float yaw, float bw_x, float bw_y, float bw_z, float nw_x, float nw_y, float nw_z, float bw_bia_x, float bw_bia_y, float bw_bia_z, float ba_x, float ba_y, float ba_z, float ba_bia_x, float ba_bia_y, float ba_bia_z, float bm_x, float bm_y, float bm_z, float bm_bia_x, float bm_bia_y, float bm_bia_z)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char *buf = (char *)msgbuf;
    _mav_put_uint32_t(buf, 0, state);
    _mav_put_float(buf, 4, q0);
    _mav_put_float(buf, 8, q1);
    _mav_put_float(buf, 12, q2);
    _mav_put_float(buf, 16, q3);
    _mav_put_float(buf, 20, roll);
    _mav_put_float(buf, 24, pitch);
    _mav_put_float(buf, 28, yaw);
    _mav_put_float(buf, 32, bw_x);
    _mav_put_float(buf, 36, bw_y);
    _mav_put_float(buf, 40, bw_z);
    _mav_put_float(buf, 44, nw_x);
    _mav_put_float(buf, 48, nw_y);
    _mav_put_float(buf, 52, nw_z);
    _mav_put_float(buf, 56, bw_bia_x);
    _mav_put_float(buf, 60, bw_bia_y);
    _mav_put_float(buf, 64, bw_bia_z);
    _mav_put_float(buf, 68, ba_x);
    _mav_put_float(buf, 72, ba_y);
    _mav_put_float(buf, 76, ba_z);
    _mav_put_float(buf, 80, ba_bia_x);
    _mav_put_float(buf, 84, ba_bia_y);
    _mav_put_float(buf, 88, ba_bia_z);
    _mav_put_float(buf, 92, bm_x);
    _mav_put_float(buf, 96, bm_y);
    _mav_put_float(buf, 100, bm_z);
    _mav_put_float(buf, 104, bm_bia_x);
    _mav_put_float(buf, 108, bm_bia_y);
    _mav_put_float(buf, 112, bm_bia_z);

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_BODY_DATA, buf, MAVLINK_MSG_ID_ATTITUDE_BODY_DATA_MIN_LEN, MAVLINK_MSG_ID_ATTITUDE_BODY_DATA_LEN, MAVLINK_MSG_ID_ATTITUDE_BODY_DATA_CRC);
#else
    mavlink_attitude_body_data_t *packet = (mavlink_attitude_body_data_t *)msgbuf;
    packet->state = state;
    packet->q0 = q0;
    packet->q1 = q1;
    packet->q2 = q2;
    packet->q3 = q3;
    packet->roll = roll;
    packet->pitch = pitch;
    packet->yaw = yaw;
    packet->bw_x = bw_x;
    packet->bw_y = bw_y;
    packet->bw_z = bw_z;
    packet->nw_x = nw_x;
    packet->nw_y = nw_y;
    packet->nw_z = nw_z;
    packet->bw_bia_x = bw_bia_x;
    packet->bw_bia_y = bw_bia_y;
    packet->bw_bia_z = bw_bia_z;
    packet->ba_x = ba_x;
    packet->ba_y = ba_y;
    packet->ba_z = ba_z;
    packet->ba_bia_x = ba_bia_x;
    packet->ba_bia_y = ba_bia_y;
    packet->ba_bia_z = ba_bia_z;
    packet->bm_x = bm_x;
    packet->bm_y = bm_y;
    packet->bm_z = bm_z;
    packet->bm_bia_x = bm_bia_x;
    packet->bm_bia_y = bm_bia_y;
    packet->bm_bia_z = bm_bia_z;

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_BODY_DATA, (const char *)packet, MAVLINK_MSG_ID_ATTITUDE_BODY_DATA_MIN_LEN, MAVLINK_MSG_ID_ATTITUDE_BODY_DATA_LEN, MAVLINK_MSG_ID_ATTITUDE_BODY_DATA_CRC);
#endif
}
#endif

#endif

// MESSAGE ATTITUDE_BODY_DATA UNPACKING


/**
 * @brief Get field state from attitude_body_data message
 *
 * @return  calculating state.
 */
static inline uint32_t mavlink_msg_attitude_body_data_get_state(const mavlink_message_t* msg)
{
    return _MAV_RETURN_uint32_t(msg,  0);
}

/**
 * @brief Get field q0 from attitude_body_data message
 *
 * @return  quaternion q0.
 */
static inline float mavlink_msg_attitude_body_data_get_q0(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  4);
}

/**
 * @brief Get field q1 from attitude_body_data message
 *
 * @return  quaternion q1.
 */
static inline float mavlink_msg_attitude_body_data_get_q1(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  8);
}

/**
 * @brief Get field q2 from attitude_body_data message
 *
 * @return  quaternion q2.
 */
static inline float mavlink_msg_attitude_body_data_get_q2(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  12);
}

/**
 * @brief Get field q3 from attitude_body_data message
 *
 * @return  quaternion q3.
 */
static inline float mavlink_msg_attitude_body_data_get_q3(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  16);
}

/**
 * @brief Get field roll from attitude_body_data message
 *
 * @return  roll angle.
 */
static inline float mavlink_msg_attitude_body_data_get_roll(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  20);
}

/**
 * @brief Get field pitch from attitude_body_data message
 *
 * @return  pitch angle.
 */
static inline float mavlink_msg_attitude_body_data_get_pitch(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  24);
}

/**
 * @brief Get field yaw from attitude_body_data message
 *
 * @return  yaw angle.
 */
static inline float mavlink_msg_attitude_body_data_get_yaw(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  28);
}

/**
 * @brief Get field bw_x from attitude_body_data message
 *
 * @return  x axis angle speed in B coordinate.
 */
static inline float mavlink_msg_attitude_body_data_get_bw_x(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  32);
}

/**
 * @brief Get field bw_y from attitude_body_data message
 *
 * @return  y axis angle speed in B coordinate.
 */
static inline float mavlink_msg_attitude_body_data_get_bw_y(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  36);
}

/**
 * @brief Get field bw_z from attitude_body_data message
 *
 * @return  z axis angle speed in B coordinate.
 */
static inline float mavlink_msg_attitude_body_data_get_bw_z(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  40);
}

/**
 * @brief Get field nw_x from attitude_body_data message
 *
 * @return  x axis angle speed in N coordinate.
 */
static inline float mavlink_msg_attitude_body_data_get_nw_x(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  44);
}

/**
 * @brief Get field nw_y from attitude_body_data message
 *
 * @return  y axis angle speed in N coordinate.
 */
static inline float mavlink_msg_attitude_body_data_get_nw_y(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  48);
}

/**
 * @brief Get field nw_z from attitude_body_data message
 *
 * @return  z axis angle speed in N coordinate.
 */
static inline float mavlink_msg_attitude_body_data_get_nw_z(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  52);
}

/**
 * @brief Get field bw_bia_x from attitude_body_data message
 *
 * @return  Zero deviation of gyro x axis.
 */
static inline float mavlink_msg_attitude_body_data_get_bw_bia_x(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  56);
}

/**
 * @brief Get field bw_bia_y from attitude_body_data message
 *
 * @return  Zero deviation of gyro y axis.
 */
static inline float mavlink_msg_attitude_body_data_get_bw_bia_y(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  60);
}

/**
 * @brief Get field bw_bia_z from attitude_body_data message
 *
 * @return  Zero deviation of gyro z axis.
 */
static inline float mavlink_msg_attitude_body_data_get_bw_bia_z(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  64);
}

/**
 * @brief Get field ba_x from attitude_body_data message
 *
 * @return  x axis acceleration in B coordinate.
 */
static inline float mavlink_msg_attitude_body_data_get_ba_x(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  68);
}

/**
 * @brief Get field ba_y from attitude_body_data message
 *
 * @return  y axis acceleration in B coordinate.
 */
static inline float mavlink_msg_attitude_body_data_get_ba_y(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  72);
}

/**
 * @brief Get field ba_z from attitude_body_data message
 *
 * @return  z axis acceleration in B coordinate.
 */
static inline float mavlink_msg_attitude_body_data_get_ba_z(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  76);
}

/**
 * @brief Get field ba_bia_x from attitude_body_data message
 *
 * @return  Zero deviation of gyro x axis acceleration.
 */
static inline float mavlink_msg_attitude_body_data_get_ba_bia_x(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  80);
}

/**
 * @brief Get field ba_bia_y from attitude_body_data message
 *
 * @return  Zero deviation of gyro y axis acceleration.
 */
static inline float mavlink_msg_attitude_body_data_get_ba_bia_y(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  84);
}

/**
 * @brief Get field ba_bia_z from attitude_body_data message
 *
 * @return  Zero deviation of gyro z axis acceleration.
 */
static inline float mavlink_msg_attitude_body_data_get_ba_bia_z(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  88);
}

/**
 * @brief Get field bm_x from attitude_body_data message
 *
 * @return  x axis magnet in B coordinate.
 */
static inline float mavlink_msg_attitude_body_data_get_bm_x(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  92);
}

/**
 * @brief Get field bm_y from attitude_body_data message
 *
 * @return  y axis magnet in B coordinate.
 */
static inline float mavlink_msg_attitude_body_data_get_bm_y(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  96);
}

/**
 * @brief Get field bm_z from attitude_body_data message
 *
 * @return  z axis magnet in B coordinate.
 */
static inline float mavlink_msg_attitude_body_data_get_bm_z(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  100);
}

/**
 * @brief Get field bm_bia_x from attitude_body_data message
 *
 * @return  Zero deviation of magnet x axis.
 */
static inline float mavlink_msg_attitude_body_data_get_bm_bia_x(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  104);
}

/**
 * @brief Get field bm_bia_y from attitude_body_data message
 *
 * @return  Zero deviation of magnet y axis.
 */
static inline float mavlink_msg_attitude_body_data_get_bm_bia_y(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  108);
}

/**
 * @brief Get field bm_bia_z from attitude_body_data message
 *
 * @return  Zero deviation of magnet z axis.
 */
static inline float mavlink_msg_attitude_body_data_get_bm_bia_z(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  112);
}

/**
 * @brief Decode a attitude_body_data message into a struct
 *
 * @param msg The message to decode
 * @param attitude_body_data C-struct to decode the message contents into
 */
static inline void mavlink_msg_attitude_body_data_decode(const mavlink_message_t* msg, mavlink_attitude_body_data_t* attitude_body_data)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    attitude_body_data->state = mavlink_msg_attitude_body_data_get_state(msg);
    attitude_body_data->q0 = mavlink_msg_attitude_body_data_get_q0(msg);
    attitude_body_data->q1 = mavlink_msg_attitude_body_data_get_q1(msg);
    attitude_body_data->q2 = mavlink_msg_attitude_body_data_get_q2(msg);
    attitude_body_data->q3 = mavlink_msg_attitude_body_data_get_q3(msg);
    attitude_body_data->roll = mavlink_msg_attitude_body_data_get_roll(msg);
    attitude_body_data->pitch = mavlink_msg_attitude_body_data_get_pitch(msg);
    attitude_body_data->yaw = mavlink_msg_attitude_body_data_get_yaw(msg);
    attitude_body_data->bw_x = mavlink_msg_attitude_body_data_get_bw_x(msg);
    attitude_body_data->bw_y = mavlink_msg_attitude_body_data_get_bw_y(msg);
    attitude_body_data->bw_z = mavlink_msg_attitude_body_data_get_bw_z(msg);
    attitude_body_data->nw_x = mavlink_msg_attitude_body_data_get_nw_x(msg);
    attitude_body_data->nw_y = mavlink_msg_attitude_body_data_get_nw_y(msg);
    attitude_body_data->nw_z = mavlink_msg_attitude_body_data_get_nw_z(msg);
    attitude_body_data->bw_bia_x = mavlink_msg_attitude_body_data_get_bw_bia_x(msg);
    attitude_body_data->bw_bia_y = mavlink_msg_attitude_body_data_get_bw_bia_y(msg);
    attitude_body_data->bw_bia_z = mavlink_msg_attitude_body_data_get_bw_bia_z(msg);
    attitude_body_data->ba_x = mavlink_msg_attitude_body_data_get_ba_x(msg);
    attitude_body_data->ba_y = mavlink_msg_attitude_body_data_get_ba_y(msg);
    attitude_body_data->ba_z = mavlink_msg_attitude_body_data_get_ba_z(msg);
    attitude_body_data->ba_bia_x = mavlink_msg_attitude_body_data_get_ba_bia_x(msg);
    attitude_body_data->ba_bia_y = mavlink_msg_attitude_body_data_get_ba_bia_y(msg);
    attitude_body_data->ba_bia_z = mavlink_msg_attitude_body_data_get_ba_bia_z(msg);
    attitude_body_data->bm_x = mavlink_msg_attitude_body_data_get_bm_x(msg);
    attitude_body_data->bm_y = mavlink_msg_attitude_body_data_get_bm_y(msg);
    attitude_body_data->bm_z = mavlink_msg_attitude_body_data_get_bm_z(msg);
    attitude_body_data->bm_bia_x = mavlink_msg_attitude_body_data_get_bm_bia_x(msg);
    attitude_body_data->bm_bia_y = mavlink_msg_attitude_body_data_get_bm_bia_y(msg);
    attitude_body_data->bm_bia_z = mavlink_msg_attitude_body_data_get_bm_bia_z(msg);
#else
        uint8_t len = msg->len < MAVLINK_MSG_ID_ATTITUDE_BODY_DATA_LEN? msg->len : MAVLINK_MSG_ID_ATTITUDE_BODY_DATA_LEN;
        memset(attitude_body_data, 0, MAVLINK_MSG_ID_ATTITUDE_BODY_DATA_LEN);
    memcpy(attitude_body_data, _MAV_PAYLOAD(msg), len);
#endif
}
